//
// Created by Jisam on 2024/5/27.
//
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define x first
#define y second
#define INF 0x3f3f3f3f
#define PII pair<int,int>
const int N = 1e5+10;
const int mod = 1e9+7;
void op1(vector<int> &nums,int l , int r ,int v){
    for(int i = l;i <= r; i ++){
        nums[i] += v;
    }
}
double op2(vector<int> &nums,int l ,int r){
    double res  = 0.0;
    for(int i = l ; i <= r ; i++){
        res += sin(nums[i]);
    }
    return res;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    int n;
    cin >> n;
    vector<int> a(n + 6);
    for(int i = 1; i <= n ; i ++) {cin >> a[i]; if(i>1)a[i] += a[i-1];}
    int q;
    cin >> q;
    while (q -- ) {
        int x;
        cin >> x;
//        cout << x <<" ====\n"  ;
        if(x  == 1){
            int l,r,v;
            cin >> l >> r >> v;
            op1(a,l, r ,v);
        }
        if(x == 2){
            int l , r;
            cin >> l >> r;
            cout <<fixed <<setprecision(1)<< op2(a,l,r) <<endl;

        }
    }
    return 0;
}
